package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.activity.recycleview.anim_rf_grid_layout.AnimRFGridLayoutActivity;
import com.qianxx.component.activity.recycleview.anim_rf_linear_layout.AnimRFLinearLayoutActivity;
import com.qianxx.component.activity.recycleview.anim_rf_staggered_grid_layout.AnimRFStaggeredGridLayoutActivity;
import com.qianxx.component.activity.recycleview.ex_refresh_view.ExRefreshViewActivity;
import com.qianxx.component.activity.recycleview.list_view.ListViewActivity;
import com.qianxx.component.activity.recycleview.pager.PagerActivity;
import com.qianxx.component.activity.recycleview.pull_recyclerview.PullRecyclerViewActivity;
import com.qianxx.component.activity.recycleview.quick_return.QuickReturnActivity;
import com.qianxx.component.activity.recycleview.recycler_banner.RecyclerBannerActivity;
import com.qianxx.component.activity.recycleview.slide_recycler_view.SlideRecyclerViewActivity;
import com.qianxx.component.activity.recycleview.water_fall_flow.WaterFallFlowActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class RecyclerViewActivity extends BaseActivity {
    @BindView(R.id.lv)
    ListView lv;
    String[] listItems = {"ListView", "The waterfall flow", "QuickReturn",
            "AnimRFLinearLayout", "AnimRFGridLayout", "AnimRFStaggeredGridLayout",
            "RecyclerBanner", "ExRefreshView", "Pager", "PullRecyclerView",
            "SlideRecyclerView"};
    ArrayAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item, listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Class cls = null;
        switch (arg2) {
            case 0:
                cls = ListViewActivity.class;
                break;
            case 1:
                cls = WaterFallFlowActivity.class;
                break;
            case 2:
                cls = QuickReturnActivity.class;
                break;
            case 3:
                cls = AnimRFLinearLayoutActivity.class;
                break;
            case 4:
                cls = AnimRFGridLayoutActivity.class;
                break;
            case 5:
                cls = AnimRFStaggeredGridLayoutActivity.class;
                break;
            case 6:
                cls = RecyclerBannerActivity.class;
                break;
            case 7:
                cls = ExRefreshViewActivity.class;
                break;
            case 8:
                cls = PagerActivity.class;
                break;
            case 9:
                cls = PullRecyclerViewActivity.class;
                break;
            case 10:
                cls = SlideRecyclerViewActivity.class;
                break;
            default:

                break;
        }
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

    @Override
    public String setTitle() {
        return "RecyclerView";
    }
}
